package com.lms.admin.base.controller;

import com.lms.admin.base.service.ISysRoleMenuService;
import com.lms.common.entity.SysRoleMenu;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sysRoleMenu")
@RequiredArgsConstructor
@PreAuthorize("hasRole('ADMIN')")
@Tag(name="角色与菜单关联相关请求")
public class SysRoleMenuController {
    private final ISysRoleMenuService baseService;

    @GetMapping("/getRoleByMenuId/{menuId}")
    public List<SysRoleMenu> getRoleByUserId(@PathVariable("menuId") Long menuId) {
        return this.baseService.getRoleByUserId(menuId);
    }
}
